{% extends "public/base.html" %}
{% load nm %}
{% load js %}

{% block head_resources %}
  {{block.super}}
  {% jsinclude "tables" %}
{% endblock %}

{% block head %}
{{block.super}}
<script type="text/javascript">
$(function() {
    $(".proctable").tablesorter({
        textExtraction: function(node) {
            val = node.getAttribute("val");
            if (val == null)
                val = node.textContent || node.innerText;
            return val;
        },
    });

    var filters = {
    "no-adv": [ "{{PROGRESS_APP_NEW}}", "{{PROGRESS_APP_RCVD}}", "{{PROGRESS_APP_HOLD}}", "{{PROGRESS_ADV_RCVD}}" ],
    unassigned: [ "{{PROGRESS_APP_HOLD}}", "{{PROGRESS_APP_OK}}", "{{PROGRESS_AM_RCVD}}" ],
    assigned: [ "{{PROGRESS_AM}}", "{{PROGRESS_AM_HOLD}}" ],
    fd: [ "{{PROGRESS_AM_OK}}", "{{PROGRESS_FD_HOLD}}" ],
    dam: [ "{{PROGRESS_FD_OK}}", "{{PROGRESS_DAM_HOLD}}" ],
    done: [ "{{PROGRESS_DAM_OK}}" ],
    };

    $("a.filter").click(function(el) {
        // Retrieve the filter name
        var filter = this.getAttribute("href").substr(1);

        // Build a quick whitelist hash
        var whitelist = {};
        if (filters[filter])
            $.each(filters[filter], function(idx, val) { whitelist[val] = true; });
        else
            whitelist = null;

        $(".proctable.open tbody tr").each(function(el) {
            var tag = this.getAttribute("tag");
            if (whitelist)
                $(this).toggle(whitelist[tag] == true);
            else
                $(this).toggle(true);
        });
        return false;
    });
});
</script>
{% endblock %}

{% block breadcrumbs %}{{block.super}} / <a href="{% url 'processes' %}">processes</a>{% endblock %}

{% block content %}

<div id="intro">
    This is a list of all applications in progress. Click on a header to sort the
    table. Shift-click to sort by more than one element.
</div>

<h1>Debian New Member - Process List</h2>

<div id="intro">
This is a list of all <a href="#open">open</a> and <a href="#done">recently closed</a> processes.
If you have applied then you should find yourself here somewhere. If you have
passed all checks and been approved as a Debian developer more than 6 months
ago, you will be listed on the <a href="{% url 'people' %}">people</a> page
instead.
</div>

<h2>New-style processes</h2>

<p>
The process workflow is being reimplemented and this page lists only the processes using the old workflow.<br>
<a href="{% url 'process_list' %}">List of processes using the new workflow.</a>
</p>

<h2 id="open">Still in progress</h2>

<ul class="menubar">
    <li><a class="filter" href="#all">All</a></li>
    <li><a class="filter" href="#no-adv">No Advocate</a></li>
    <li><a class="filter" href="#unassigned">Un-Assigned</a></li>
    <li><a class="filter" href="#assigned">Processed</a></li>
    <li><a class="filter" href="#fd">Waiting for Front Desk</a></li>
    <li><a class="filter" href="#dam">Waiting for DAM</a></li>
    <li><a class="filter" href="#done">New Members</a></li>
</ul>

{% include "public/process_table.html" with visitor=visitor p=p procs=open class="open" only %}

<h2 id="done">Recently closed</h2>

{% include "public/process_table.html" with visitor=visitor p=p procs=done class="done" only %}

{% endblock %}

